package pers.wq.model.bean;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import pers.wq.controller.BaseIndexAction;
import pers.wq.model.CollegeModel;
import pers.wq.util.TagManager;

public class Major extends BaseBean {
	private String mid;
	private String mname;
	private College college;
	private String majormsg;
	private int num;
	private Set<Student> student;//以收入的学生
	private Set<MajorRequest> majorRequest;
	private Set<SelectMajor> selectMajor;
	
	public Major() {
		// TODO Auto-generated constructor stub
		if(BaseIndexAction.containSession(BaseIndexAction.ID_TAG)) {
			if(null == college) {
				college = new College();
			}
			college.setCid(Integer.parseInt(BaseIndexAction.getSession(BaseIndexAction.ID_TAG)));
		}
	}
	
	@Override
	public Map<String, String> tagMap() {
		// TODO Auto-generated method stub
		Map<String,String> reMap = new LinkedHashMap<String,String>();
		if(getId() != 0){
			reMap.put(TAG_HIDDEN,TagManager.inputHidden("major.id", getId()+""));
		}
		reMap.put("专业名",TagManager.inputText("major.mname", this.getMname()));
		reMap.put("预计招收人数",TagManager.inputText("major.num", this.getNum()+""));
		CollegeModel cm = new CollegeModel();
		Map<String,String> map = cm.getAllCollegeMap();
		String defaultKey = null == college ? null : college.getId() == 0 ? null : String.valueOf(college.getId());
		reMap.put("所属学院", TagManager.selectTag("major.college.cid", defaultKey, map));
		System.out.println("Major [1");
		String test = TagManager.textareaTag("major.majormsg",this.getMajormsg());
		System.out.println("Major [" + test);
		reMap.put("专业介绍", test);
		return reMap;
	}
	
	@Override
	public void setId(int id) {
		// TODO Auto-generated method stub
		this.mid = id+"";
	}
	@Override
	public int getId() {
		// TODO Auto-generated method stub
		return Integer.parseInt(this.mid);
	}
	
	public String getMid() {
		return this.mid;
	}
	public void setMid(int mid) {
		this.mid = mid == 0 ? null : mid+"";
	}
	public void setMid(String mid) {
		System.out.println("Major setMid " + mid);
		this.mid = mid.equals("null")?null:mid;
	}
	public String getMname() {
		return mname;
	}
	public void setMname(String mname) {
		this.mname = mname;
	}
	public String getMajormsg() {
		return majormsg;
	}
	public void setMajormsg(String majormsg) {
		this.majormsg = majormsg;
	}
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public Set<Student> getStudent() {
		return student;
	}
	public void setStudent(Set<Student> student) {
		this.student = student;
	}
	public College getCollege() {
		return college;
	}
	public void setCollege(College college) {
		this.college = college;
	}
	public Set<MajorRequest> getMajorRequest() {
		return majorRequest;
	}
	public void setMajorRequest(Set<MajorRequest> majorRequest) {
		this.majorRequest = majorRequest;
	}
	public Set<SelectMajor> getSelectMajor() {
		return selectMajor;
	}
	public void setSelectMajor(Set<SelectMajor> selectMajor) {
		this.selectMajor = selectMajor;
	}
}
